package com.ktgj.flight.service.impl;

import java.math.BigDecimal;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktgj.flight.mapper.FlightCountryMapper;
import com.ktgj.flight.domain.FlightCountry;
import com.ktgj.flight.service.IFlightCountryService;

/**
 * 系统字典_国家Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-06-01
 */
@Service
public class FlightCountryServiceImpl implements IFlightCountryService 
{
    @Autowired
    private FlightCountryMapper flightCountryMapper;

    /**
     * 查询系统字典_国家
     * 
     * @param countryId 系统字典_国家ID
     * @return 系统字典_国家
     */
    @Override
    public FlightCountry selectFlightCountryById(BigDecimal countryId)
    {
        return flightCountryMapper.selectFlightCountryById(countryId);
    }

    /**
     * 查询系统字典_国家列表
     * 
     * @param flightCountry 系统字典_国家
     * @return 系统字典_国家
     */
    @Override
    public List<FlightCountry> selectFlightCountryList(FlightCountry flightCountry)
    {
        List<FlightCountry> flightCountries = flightCountryMapper.selectFlightCountryList(flightCountry);
        flightCountries.forEach(item -> {
            item.setCountryId(item.getCountryId().stripTrailingZeros());
        });
        return flightCountries;
    }

    /**
     * 新增系统字典_国家
     * 
     * @param flightCountry 系统字典_国家
     * @return 结果
     */
    @Override
    public int insertFlightCountry(FlightCountry flightCountry)
    {
        return flightCountryMapper.insertFlightCountry(flightCountry);
    }

    /**
     * 修改系统字典_国家
     * 
     * @param flightCountry 系统字典_国家
     * @return 结果
     */
    @Override
    public int updateFlightCountry(FlightCountry flightCountry)
    {
        return flightCountryMapper.updateFlightCountry(flightCountry);
    }

    /**
     * 批量删除系统字典_国家
     * 
     * @param countryIds 需要删除的系统字典_国家ID
     * @return 结果
     */
    @Override
    public int deleteFlightCountryByIds(BigDecimal[] countryIds)
    {
        return flightCountryMapper.deleteFlightCountryByIds(countryIds);
    }

    /**
     * 删除系统字典_国家信息
     * 
     * @param countryId 系统字典_国家ID
     * @return 结果
     */
    @Override
    public int deleteFlightCountryById(BigDecimal countryId)
    {
        return flightCountryMapper.deleteFlightCountryById(countryId);
    }
}
